<template>
  <div class="box">
    <div class="title">
      <span class="el-icon-arrow-left" @click="$router.go(-1)"></span>
      会员
    </div>
    <div class="vip_crad">
      <div class="vip_title">{{ info.name }}</div>
      <div class="progress_flex">
        <div class="progress">
          <div :style="processStyle" class="progress_back"></div>
        </div>
        <img src="../../../../assets/static/membership/a7.png" alt="">
      </div>
      <div>{{ info.text }}</div>
      <div class="vip_right_info" @click="gotoLevel">
        <div>view Tier Benefits</div>
        <div class="el-icon-arrow-right"></div>
      </div>
    </div>
    <!--  -->
    <div class="card_list">
      <div class="card_title">
        <img src="../../../../assets/static/recharge/q4.png" alt=""/>
        <div>对方账户</div>
      </div>
      <div class="card_one">
        <div>个i-JoozRewards积分</div>
      </div>
      <div @click="$router.push({path:'/listpointsLog'})" class="card_flex">
        <div>查看我的积分历史</div>
        <div class="el-icon-arrow-right"></div>
      </div>
      <div class="card_flex">
        <div>了解如何赚取更多积分</div>
        <div class="el-icon-arrow-right"></div>
      </div>
      <div class="card_flex">
        <div>常见问题</div>
        <div class="el-icon-arrow-right"></div>
      </div>
    </div>
    <div class="cancel">取消我的i -Jooz会员</div>
  </div>
</template>

<script>
import {info} from '@/api/merbership/member'

export default {
  data() {
    return {
      info: {},
      processStyle: {
        width: '10%'
      }
    }
  },
  methods: {
    /**
     * 跳转等级介绍页面
     */
    gotoLevel() {
      this.$router.push({path: '/listLevelIntro'})
    },
    // -------------------- axios ---------------------
    /**
     * 会员详情
     */
    getInfo() {
      const pd = {}
      info(pd)
        .then(res => {
          this.info = res.data.data
          this.processStyle.width = String((Number(res.data.data.grade_score) / 300) * 100) + '%'
          console.log(this.processStyle)
        })
    }
  },
  mounted() {
    this.getInfo()
  }
}
</script>

<style lang="scss" scoped>
.box {

  /* 标题 */
  .title {
    background-color: #7ac91b;
    color: #fff;
    font-size: 18px;
    text-align: center;
    padding: 15px;
    font-weight: bold;
  }

  .title .el-icon-arrow-left {
    float: left;
    margin-top: 5px;
  }

  // 会员
  .vip_crad {
    background-image: url(../../../../assets/static/membership/a9.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    padding: 25px;
    text-align: center;
    font-size: 12px;
    color: #FFFFFF;

    // 成员 标题
    .vip_title {
      font-size: 21px;
      color: #FFFFFF;
      font-weight: bold;
    }

    // 成员进度条
    .progress_flex {
      display: flex;
      align-items: center;
      margin: 15px 0;

      .progress {
        width: 100%;
        background-color: #336202;
        height: 10px;
        border-radius: 15px;

        .progress_back {
          width: 40%;
          background-color: #FFB200;
          height: 10px;
          border-radius: 15px;
        }
      }

      img {
        width: 21px;
        margin-left: 10px;
      }
    }

    .vip_right_info {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background-color: #58A904;
      padding: 8px;
      border-radius: 8px;
      margin: 20px 0;
    }
  }

  .card_list {
    /* card 标题 */
    margin: 0 15px;

    > div {
      background-color: #fff;
      box-shadow: 0 0 8px #ccc;
      margin: 12px 0;
      padding: 13px;
      border-radius: 10px;
    }

    .card_title {
      display: flex;
      align-items: center;
      font-size: 14px;
      font-weight: bold;
      background: none;
      box-shadow: none;
      padding: 0;
      margin: 0;

      > div {
        margin-left: 13px;
      }
    }

    .card_one {
      font-size: 13px;
      color: #FFFFFF;

      > div {
        background-image: url(../../../../assets/static/membership/a10.png);
        background-repeat: no-repeat;
        background-size: 100% 100%;
        padding: 10px;
        text-align: center;
      }
    }

    .card_flex {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 13px;

      .el-icon-arrow-right {
        font-weight: 900;
      }
    }
  }

  // 取消
  .cancel {
    background-image: url(../../../../assets/static/membership/a11.png);
    text-align: center;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 26px 0 33px 0;
    color: #FFFFFF;
    margin: 25px;
    font-size: 12px;
  }
}
</style>
